package com.xnfh.home.adapter

import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseDataBindingHolder
import com.xnfh.framework.bean.TidingBean
import com.xnfh.home.R
import com.xnfh.home.databinding.ItemMessageBinding
import com.xnfh.image.ImageHelper
import com.xnfh.image.ImageUrl


/**
 * @Description:
 * @Author: ziheng
 * @CreateDate: 2023/10/10 3:26 PM
 * @UpdateUser: ziheng
 * @UpdateDate: 2023/10/10 3:26 PM
 * @UpdateRemark: 更新说明
 */
class MessageAdapter: BaseQuickAdapter<TidingBean,BaseDataBindingHolder<ItemMessageBinding>>(R.layout.item_message) {

    override fun convert(holder: BaseDataBindingHolder<ItemMessageBinding>, item: TidingBean) {
        val dataBinding = holder.dataBinding
        holder.setText(R.id.item_message_title,item.typeName)
        ImageHelper.instance?.loadNetImg(context,ImageUrl.BASEURL + item.typeImg,dataBinding?.itemMessageImg,
            com.xnfh.common.R.mipmap.image_error,com.xnfh.common.R.mipmap.image_error)
        if(item.read > 0){
            holder.setText(R.id.item_message_no_read_message,item.read.toString())
            holder.setGone(R.id.item_message_no_read_message,false)
        }else{
            holder.setGone(R.id.item_message_no_read_message,true)
        }
    }

}